package com.kb.thread;

import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.kb.crawl.KBCrawlOfAutoHome;

public class MyThread extends BaseThread {

	public MyThread(int sizeOfThreadPool, List<Integer> carIDs) {
		super(sizeOfThreadPool, carIDs);
	}

	@Override
	public void start() {
		StringBuffer sb = new StringBuffer();
		sb.append("线程池大小=" + this.getSizeOfThreadPool() + "\t" + "汽车ID数量=" + this.getCarIDs().size() + "\t" + "CarID:");
		for (Integer cid : this.getCarIDs()) {
			sb.append(cid + "\t");
		}
		logger.info(sb.toString());
		ExecutorService fixedThreadPool = Executors.newFixedThreadPool(this.getSizeOfThreadPool());
		for (int i = 0; i < this.getCarIDs().size(); i++) {
			fixedThreadPool.execute(new KBCrawlOfAutoHome(this.getCarIDs().get(i)));
		}
		fixedThreadPool.shutdown();
	}

}
